<template>
	<el-input v-model="inputValue" v-bind="$attrs" @input="astrictInputData"></el-input>
</template>

<script>
import emitter from 'element-ui/src/mixins/emitter';
export default {
	name: 'swLetterInput',
	mixins: [emitter],
	props: {
		value: String
	},
	data() {
		return {
			inputValue: this.value
		};
	},
	watch: {
		value(val) {
			this.inputValue = val;
		},
		inputValue(val) {
			this.$emit('input', val);
			this.dispatch('ElFormItem', 'el.form.change', [val]);
		}
	},
	methods: {
		astrictInputData(value) {
			this.inputValue = value.replace(/[^a-zA-Z]/g, '');
		}
	}
};
</script>

<style lang="scss" scoped></style>
